package com.edu.atams.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.edu.atams.common.dto.VotingStatistics;
import com.edu.atams.entity.Voting;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author czj666
 * @since 2021-10-09
 */
@Mapper
@Repository
public interface VotingMapper extends BaseMapper<Voting> {

    /**
     * 因为page分页只能查询到voting的类型，想要将查到的数据封装到指定对象，并进行分页操作
     * @param wrapper
     * @return
     */
    @Select("select * from voting ${ew.customSqlSegment}")
    Page<VotingStatistics> findByCondition(IPage page, @Param(Constants.WRAPPER) Wrapper wrapper);


}
